package com.ihunanren.biz.weixin.domain.school;

import static com.google.common.base.Preconditions.checkArgument;

import com.ihunanren.biz.common.SpringBeanLoader;
import com.ihunanren.biz.weixin.manager.IDivisionManager;

public class Division {


	private static final IDivisionManager divisionManager = (IDivisionManager) SpringBeanLoader.getSpringBean("divisionManager");
	
	private final long schoolId;

	public Division(long schoolId) {
		checkArgument(schoolId >0,"schoolId is required.");
		this.schoolId = schoolId;
	}
	
	public String getSchoolName(){
		Country country = divisionManager.getCuntry();
		for(Province province : country.getProvs() ){
			for(University university :  province.getUnivs()){
				if(university.getId() == schoolId)
				return university.getName();
			}
		}
		return null;
	}
	
	public String getProvinceName(){
		Country country = divisionManager.getCuntry();
		for(Province province : country.getProvs() ){
			for(University university :  province.getUnivs()){
				if(university.getId() == schoolId)
				return province.getName();
			}
		}
		return null;
	}

	
}
